
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>身份认证</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/swiper.min.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/reset.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/common.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/style.css">
	<script src="<?php echo THEME_PATH;?>js/jquery-1.8.3.min.js"></script>
	<script src="<?php echo THEME_PATH;?>js/swiper.min.js"></script>
	<script src="/statics/js/layer/layer.js"></script>
</head>
<body>
	<!-- S header -->
	<header>
		<a href="<?php echo session('id') ? '/index.php?m=user&c=home&a=index' : '/index.php?m=user&c=public&a=login' ; ?>" class="headerL iconfont">&#xe69f;</a>
		<h1>身份认证</h1>
	</header>
	<!-- E header -->
	<h2 class="approve-h2">请上传本人有效期内的身份证</h2>
	<dl class="sfz_box alignC userImg" id="header_file">
		<dt class="title">身份证正面</dt>
		<dd id="img1_box">
			<a href="javascript:;"><img src="<?php echo $user_info['identity_front'] ?$user_info['identity_front'] :THEME_PATH.'images/sfz1.png'; ?>" alt="" width="277" class="sfz_img"></a>
            <input type="hidden" name="img1" id="img1" />
            <input type="file" id="file_up" name="上传" style="display:none;"/>
        </dd>
	</dl>
	<dl class="sfz_box alignC sfz_box2 userImg" id="header_file1">
		<dt class="title">身份证背面</dt>
		<dd id="img2_box">
			<a href="javascript:;"><img src="<?php echo $user_info['identity_side'] ?$user_info['identity_side'] :THEME_PATH.'images/sfz2.png'; ?>" alt="" width="277" class="sfz_img"></a>
            <input type="hidden" name="img1" id="img1" />
            <input type="file" id="file_up" name="上传" style="display:none;"/>
        </dd>
	</dl>
    <form class="registerform" action="<?php echo U('User/user/dousercert_pic');?>" method="post" >
        <input type="hidden" name="identity_front" id="pic1"  value="<?php echo $user_info['identity_front'];?>" >
        <input type="hidden" name="identity_side" id="pic2"  value="<?php echo $user_info['identity_side'];?>">
        <!-- <input type="hidden" name="pic3" id="pic3" datatype="*" value="<?php echo $rzinfo['pic3'];?>"  nullmsg='请上传手持身份证照'> -->
        <!-- <a href="javascript:;" class="service_affirm_btn" onclick="submitForm();">确定</a> -->
    </form>
	<a href="javascript:;" class="btn">提交</a>

     
</body>
<link href="/statics/js/webuploader/webuploader.css" rel="stylesheet" />
<script src="/statics/js/webuploader/webuploader.js" type="text/javascript"></script>
<script type="text/javascript">
    var img1 = new WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#img1_box',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    img1.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
            $("#pic1").attr('value', response.url);
        }
        console.log(response);
    }
    img1.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }



    var img2 = new WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#img2_box',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    img2.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
            $("#pic2").attr('value', response.url);
        }
        console.log(response);
    }
    img2.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }

    var img3 = WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#img3_box',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    img3.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
            $("#pic3").attr('value', response.url);
        }
        console.log(response);
    }
    img3.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }

    $('.btn').click(function(){
        var identity_front = $("input[name='identity_front']").val();
        var identity_side =  $("input[name='identity_side']").val();
        var username = "<?php echo $username; ?>";
        if(!identity_front  || !identity_side){
            layer.msg('请选择身份证照片');
            return false;
        }
        $.ajax({
				url:"/index.php/?m=user&c=home&a=img_upload",
				type:'post',
				data:{identity_front:identity_front,identity_side:identity_side,username:username},
				dataType:'json',
				success:function(data){
			
					if(data.status ==0){
						layer.msg(data.info);
					}else{
						layer.msg(data.info);
                        setTimeout(function(){
        					location.href = "/index.php?m=user&c=home&a=sure_info&username="+username;
    					},1000);
						
						return;
					}
				}
			})	
    })
</script>
</html>